﻿using UnityEngine;

namespace WoogiWorld.Event
{
    public class MonoEventDispatcher : MonoEventBase
    {
        public static MonoEventDispatcher Instance;
        private void Awake()
        {
            Instance = this;
        }
        void Start()
        {
            this.AddEventListener(EventType.Notify, this, OnNotify);
        }

        protected override void OnDestroy()
        {
            this.RemoveAllEventListener(this);
            base.OnDestroy();
        }

        private void OnNotify(EventMessage info)
        {
            if (info.CheckData())
            {
                string msg = (string)info.Data;
                Debug.Log(msg);
            }
        }
    }
}
